//**解决一组互相依赖的对象的创建工作**//
//封装多系列对象创建工作，指定接口负责一系列相关对象或者类的创建

class DBConnection
{
public:

};

 class DBCommand
 {

 };

 class DataReader
 {

 };

class DBFactory
{
	virtual DBConnection* CreatDBConnnection() = 0;
	virtual DBCommand* CreatDBCommand() = 0;
	virtual DataReader* CreatDataReader() = 0;	
}

//一组有关联的操作
//sql
class SqlConnection: public DBConnection
{

};

class SqlCommand: public DBCommand
{

};


class SqlReader: public DataReader
{

};

//相较于工厂模式的分离独立的业务，关联性的一组业务更适合抽象工厂
//Sql的数据库只能是Sql的一套操作，不可能用Sql的链接执行Oracle的Command
class SqlFactory: public DBFactory
{
	virtual DBConnection* CreatDBConnnection() = 0;
	virtual DBCommand* CreatDBCommand() = 0;
	virtual DataReader* CreatDataReader() = 0;
};

//oracle
//....


class EmployeeDAO
{
	DBFactory* dbFactory;
public:
	std::vector<EmployeeDAO> GetEmployee()
	{
		DBConnection* connection = dbFactory->CreatDBConnnection();
		connection->connectionString("...");
	}

	DBCommand* command = dbFactory->CreatDBCommand();
	command->commandTxt("...");
	command->SetConnection(connection);//关联性

	DataReader* reader = command->ExecuteReader(); //关联性
	while(reader->Read())
	{
		//data operation
	} 
};